// stores/permission.js
import { defineStore } from 'pinia'
import { authRoutes } from '@/router/routes'

export const usePermissionStore = defineStore('permission', {
  state: () => ({
    routes: []
  }),

  actions: {
    // 在permission store中添加路由生成方法
    generateRoutes() {
      try {
        console.log(authRoutes,"---")
        this.routes = authRoutes.filter(route => 
          route.meta && !route.meta.hidden
        )
        return this.routes
      } catch (error) {
        console.error('路由生成失败:', error)
        return []
      }
    }
  }
})

function filterAsyncRoutes(routes, roles) {
  // 自定义过滤逻辑
}
